﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using OrganizerLibrary;
using OrganizerLibrary.Settings;

namespace DownloadOrganizer
{
    public partial class OrganizerService : ServiceBase
    {
        private OrganizerContext _context;
        private Organizer _organizer;

        public OrganizerService()
        {
            InitializeComponent();
            Initialize();
        }

        private void Initialize()
        {
            _context = OrganizerContext.Instantiate(OrganizerSettings.Instance.DownloadDirectory);
        }

        protected override void OnStart(string[] args)
        {
            _organizer = Organizer.Instantiate(_context);
            _organizer.Start();
        }

        protected override void OnStop()
        {
            _organizer.Stop();
            _organizer.Dispose();
        }
    }
}
